﻿using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using xiaodingmarket_application.Interfaces;
using xiaodingmarket_application.Service;
using xiaodingmarket_Domain_core.Bus;
using xiaodingmarket_Domain_core.Notificatiions;

namespace xiaodingmarket_service.Controllers.Sales
{
    public class SellController : ApiController
    {
        
        private readonly ISellService _sellService;
        public SellController(SellService sellService, INotificationHandler<DomainNotification> notifications, IMediatorHandler mediator) : base(notifications, mediator)
        {
            _sellService = sellService;
        }
        /// <summary>
        /// 用户点击想要,商品域增加想要者列表
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="kind"></param>
        /// <param name="Condition"></param>
        /// <param name="who"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("Wanter")]
        [Authorize(Policy = "CanBasicoperation")]
        public IActionResult WanterGet(string access_token, Guid friendid, Guid commodityid, Guid wanterid)
        {
            _sellService.WantAndTobeFriend(access_token, friendid, commodityid, wanterid);
            return Response();
        }
    }
}
